package iodemo;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class Copy {
    public static void main(String[] args) throws IOException {
        FileInputStream fileInputStream = new FileInputStream("./img.png");
        FileOutputStream fileOutputStream = new FileOutputStream("./img_cp6.png");
        byte[] data = new byte[fileInputStream.available()];
        int len;
        while ((len = fileInputStream.read(data)) != -1) {
            System.out.println("当前读取到的字节为:" + len);
            fileOutputStream.write(data);
        }
    }
}
